package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.ShopUserAddressMapper;
import com.ruoyi.shop.domain.ShopUserAddress;
import com.ruoyi.shop.service.IShopUserAddressService;
import com.ruoyi.common.core.text.Convert;

/**
 * 收货地址Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2021-09-12
 */
@Service
public class ShopUserAddressServiceImpl implements IShopUserAddressService 
{
    @Autowired
    private ShopUserAddressMapper shopUserAddressMapper;

    /**
     * 查询收货地址
     * 
     * @param id 收货地址主键
     * @return 收货地址
     */
    @Override
    public ShopUserAddress selectShopUserAddressById(Long id)
    {
        return shopUserAddressMapper.selectShopUserAddressById(id);
    }

    /**
     * 查询收货地址列表
     * 
     * @param shopUserAddress 收货地址
     * @return 收货地址
     */
    @Override
    public List<ShopUserAddress> selectShopUserAddressList(ShopUserAddress shopUserAddress)
    {
        return shopUserAddressMapper.selectShopUserAddressList(shopUserAddress);
    }

    /**
     * 新增收货地址
     * 
     * @param shopUserAddress 收货地址
     * @return 结果
     */
    @Override
    public int insertShopUserAddress(ShopUserAddress shopUserAddress)
    {
        shopUserAddress.setCreateTime(DateUtils.getNowDate());
        return shopUserAddressMapper.insertShopUserAddress(shopUserAddress);
    }

    /**
     * 修改收货地址
     * 
     * @param shopUserAddress 收货地址
     * @return 结果
     */
    @Override
    public int updateShopUserAddress(ShopUserAddress shopUserAddress)
    {
        shopUserAddress.setUpdateTime(DateUtils.getNowDate());
        return shopUserAddressMapper.updateShopUserAddress(shopUserAddress);
    }

    /**
     * 批量删除收货地址
     * 
     * @param ids 需要删除的收货地址主键
     * @return 结果
     */
    @Override
    public int deleteShopUserAddressByIds(String ids)
    {
        return shopUserAddressMapper.deleteShopUserAddressByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除收货地址信息
     * 
     * @param id 收货地址主键
     * @return 结果
     */
    @Override
    public int deleteShopUserAddressById(Long id)
    {
        return shopUserAddressMapper.deleteShopUserAddressById(id);
    }
}
